﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartMathLibrary
{
    /// <summary>
    /// This class represents an abstract layer for convergence tests.
    /// </summary>
    [Serializable]
    public class AbstractConvergenceTest
    {
        /// <summary>
        /// Descripes if there is convergence.
        /// </summary>
        protected bool convergence;

        /// <summary>
        /// The number of iterations, before convergence.
        /// </summary>
        protected int neededIterations;

        /// <summary>
        /// The distance between the current iteration result and the last iteration result.
        /// </summary>
        protected double relativeError;

        /// <summary>
        /// Initializes a new instance of the <see cref="AbstractConvergenceTest"/> class.
        /// </summary>
        public AbstractConvergenceTest()
        {
        }

        /// <summary>
        /// Gets a value indicating that there is convergence.
        /// </summary>
        /// <value>True if there is convergence otherwise, false.</value>
        public bool Convergence
        {
            get { return convergence; }
        }

        /// <summary>
        /// Gets the needed iterations before there is convergence.
        /// </summary>
        /// <value>The needed iterations before there is convergence.</value>
        public int NeededIterations
        {
            get { return neededIterations; }
        }

        /// <summary>
        /// Gets the distance between the current iteration result and the last iteration result.
        /// </summary>
        /// <value>The distance between the current iteration result and the last iteration result.</value>
        public double RelativeError
        {
            get { return relativeError; }
        }
    }
}